{% load staticfiles %}

<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>AdminLTE 2 | Dashboard</title>
		<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
		<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
		<link rel="stylesheet" href="{% static 'css/font-awesome.min.css' %}">
		<link rel="stylesheet" href="{% static 'dist/css/AdminLTE.min.css' %}">
		
		 <script type="text/javascript">
			if (localStorage.getItem("keySss")!="ok"){
				window.location.href="http://localhost:8000"
				var data = JSON.parse(localStorage.getItem("logMsg"));
			}
		</script> 
		
		
		<link rel="stylesheet" href="{% static 'dist/css/skins/_all-skins.min.css' %}">

		<style type="text/css">
			body {
				min-width: 1122px;
			}
			
			.black_Overlay {
				display: none;
				position: absolute;
				top: 0%;
				left: 0%;
				width: 100%;
				height: 100%;
				background-color: black;
				z-index: 1001;
				-moz-opacity: 0.8;
				opacity: .50;
				filter: alpha(opacity=80);
			}
			
			.white_Content {
				display: none;
				position: absolute;
				top: 10%;
				left: 10%;
				width: 80%;
				height: 80%;
				border: 8px solid lightblue;
				background-color: white;
				z-index: 1002;
				overflow: auto;
			}
		</style>

		{% block css %}{% endblock %}

	</head>

	<body class="hold-transition skin-blue sidebar-mini"onbeforeunload="RunOnBeforeUnload()" >
		<div class="wrapper">

			<!-- 头部 -->
			<header class="main-header">

				<!-- logo -->
				<a href="###" class="logo">
					<span class="logo-mini"><b><label for="" id="namelabel">福</label></b></span>
					<span class="logo-lg"><b><label for="" id="namelabel">嘉福祥商城</label></b></span>
				</a>

				<!-- 导航条 -->
				<nav class="navbar navbar-static-top">

					<!-- 展开 折叠按钮 -->
					<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
						<span class="sr-only">Toggle navigation</span>
					</a>
					<!-- 头部导航条右侧的东西 -->
					<div class="navbar-custom-menu">
						<ul class="nav navbar-nav">
							<!-- Messages: style can be found in dropdown.less-->
							<li class="dropdown messages-menu">
								<a href="#" id="messageNumber" class="dropdown-toggle" data-toggle="dropdown">
									<i class="fa fa-envelope-o"></i>
								</a>
								<ul class="dropdown-menu" id="allMessage">
									<li>
										<ul class="menu daSB" id="messageRead">
										</ul>
									</li>
									<li class="footer">
										<a href="http://localhost:8000/leavingMessage/">See All Messages</a>
									</li>
								</ul>
							</li>
							<!-- Notifications: style can be found in dropdown.less -->
							<li class="dropdown notifications-menu">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown">
									<i class="fa fa-bell-o"></i>
									<span class="label label-warning">10</span>
								</a>
								<ul class="dropdown-menu">
									<li class="header">You have 10 notifications</li>
									<li>
										<!-- inner menu: contains the actual data -->
										<ul class="menu">
											<li>
												<a href="#">
													<i class="fa fa-users text-aqua"></i> 5 new members joined today
												</a>
											</li>
											<li>
												<a href="#">
													<i class="fa fa-warning text-yellow"></i> Very long description here that may not fit into the page and may cause design problems
												</a>
											</li>
											<li>
												<a href="#">
													<i class="fa fa-users text-red"></i> 5 new members joined
												</a>
											</li>
											<li>
												<a href="#">
													<i class="fa fa-shopping-cart text-green"></i> 25 sales made
												</a>
											</li>
											<li>
												<a href="#">
													<i class="fa fa-user text-red"></i> You changed your username
												</a>
											</li>
										</ul>
									</li>
									<li class="footer">
										<a href="#">View all</a>
									</li>
								</ul>
							</li>
							<!-- Tasks: style can be found in dropdown.less -->
							<li class="dropdown tasks-menu">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown">
									<i class="fa fa-flag-o"></i>
									<span class="label label-danger">9</span>
								</a>
								<ul class="dropdown-menu">
									<li class="header">You have 9 tasks</li>
									<li>
										<!-- inner menu: contains the actual data -->
										<ul class="menu">
											<li>
												<!-- Task item -->
												<a href="#">
													<h3>
                        Design some buttons
                        <small class="pull-right">20%</small>
                      </h3>
													<div class="progress xs">
														<div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
															<span class="sr-only">20% Complete</span>
														</div>
													</div>
												</a>
											</li>
											<!-- end task item -->
											<li>
												<!-- Task item -->
												<a href="#">
													<h3>
                        Create a nice theme
                        <small class="pull-right">40%</small>
                      </h3>
													<div class="progress xs">
														<div class="progress-bar progress-bar-green" style="width: 40%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
															<span class="sr-only">40% Complete</span>
														</div>
													</div>
												</a>
											</li>
											<!-- end task item -->
											<li>
												<!-- Task item -->
												<a href="#">
													<h3>
                        Some task I need to do
                        <small class="pull-right">60%</small>
                      </h3>
													<div class="progress xs">
														<div class="progress-bar progress-bar-red" style="width: 60%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
															<span class="sr-only">60% Complete</span>
														</div>
													</div>
												</a>
											</li>
											<!-- end task item -->
											<li>
												<!-- Task item -->
												<a href="#">
													<h3>
                        Make beautiful transitions
                        <small class="pull-right">80%</small>
                      </h3>
													<div class="progress xs">
														<div class="progress-bar progress-bar-yellow" style="width: 80%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
															<span class="sr-only">80% Complete</span>
														</div>
													</div>
												</a>
											</li>
											<!-- end task item -->
										</ul>
									</li>
									<li class="footer">
										<a href="#">View all tasks</a>
									</li>
								</ul>
							</li>
							<!-- User Account: style can be found in dropdown.less -->
							<li class="dropdown user user-menu">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown">
									<img src="{% static 'dist/img/user2-160x160.jpg' %}" class="user-image" alt="User Image">
									<span class="hidden-xs"><label for="" id="namelabel"></label></span>
								</a>
								<ul class="dropdown-menu">
									<!-- User image -->
									<li class="user-header">
										<img src="{% static 'dist/img/user2-160x160.jpg' %}" class="img-circle" alt="User Image">

										<p>
											<label for="" id="xxxxxxxx" name="namelabel" value="" ></label> - 网页开发
											<small>2017年12月</small>
										</p>
									</li>
									<!-- Menu Body -->
									<li class="user-body">
										<div class="row">
											<div class="col-xs-4 text-center">
												<a href="#">兴趣</a>
											</div>
											<div class="col-xs-4 text-center">
												<a href="#">课程</a>
											</div>
											<div class="col-xs-4 text-center">
												<a href="#">语言</a>
											</div>
										</div>
										<!-- /.row -->
									</li>
									<!-- Menu Footer-->
									<li class="user-footer">
										<div class="pull-left">
											<a href="#" class="btn btn-default btn-flat">个人资料</a>
										</div>
										<div class="pull-right">
											<a href="#" class="btn btn-default btn-flat exit">退出</a>
										</div>
									</li>
								</ul>
							</li>
							<!-- Control Sidebar Toggle Button -->
							<li>
								<a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
							</li>
						</ul>
					</div>

				</nav>
			</header>
			<!-- 左侧菜单区域 -->
			<aside class="main-sidebar">
				<section class="sidebar">
					<!-- 左侧用户信息部分 -->
					<div class="user-panel">
						<div class="pull-left image">
							<img src="{% static 'dist/img/user2-160x160.jpg' %}" class="img-circle" alt="User Image">
						</div>
						<div class="pull-left info">
							<h4><label for="" id="yyy" name="namelabel" value="" ></label></h4>
							<!-- <label for="" id="xxxxxxxx" name="namelabel" value="" ></label> -->
						</div>
					</div>
					<!-- 左侧搜索框部分 -->
					<form action="http://localhost:8000/goodsManage/" method="post" class="sidebar-form">
						<div class="input-group">
							<input type="text" name="baseSelectName" class="form-control" placeholder="商品搜索...">
							<span class="input-group-btn">
			                <button type="submit" name="search" id="search-btn" class="btn btn-flat">
			                  <i class="fa fa-search"></i>
			                </button>
			              	</span>
						</div>
					</form>
					<!-- 左侧列表部分 -->
					<ul class="sidebar-menu" data-widget="tree">
						<li class="header">MAIN NAVIGATION</li>

						<li class="treeview">
							<a href="#">
								<i class="fa fa-dashboard"></i> <span>账号管理</span>
								<span class="pull-right-container">
			              		<i class="fa fa-angle-left pull-right"></i>
			            		</span>
							</a>
							<ul class="treeview-menu">
								
								<li >
									<a href="/userManage/"><i class="fa fa-dashboard"></i> 会员管理</a>
								</li>
								<li >
									<a href="/activeManage/"><i class="fa fa-dashboard"></i> 活动管理</a>
								</li>
								<li >
									<a href="/drawManage/"><i class="fa fa-dashboard"></i> 抽奖管理</a>
								</li>
							</ul>
						</li>

						<li class="treeview ">
							<a href="#">
								<i class="fa fa-clock-o"></i> <span>商品管理</span>
								<span class="pull-right-container">
			                    <i class="fa fa-angle-left pull-right"></i>
			                  	</span>
							</a>
							<ul class="treeview-menu">
								<li >
									<a href="/goodsManage/"><i class="fa fa-clock-o"></i> 商品列表</a>
								</li>
								<li >
									
									<a href="/recomendGoods/"><i class="fa fa-clock-o"></i> 推荐商品</a>
								</li>
							</ul>
						</li>

						<li class=" treeview ">
							<a href="#">
								<i class="fa fa-flag-o"></i> <span>地面店管理</span>
								<span class="pull-right-container">
		                        <i class="fa fa-angle-left pull-right"></i>
		                    	</span>
							</a>
							<ul class="treeview-menu">
								<li >
									<a href="/cartsManage/"><i class="fa fa-flag"></i>购物车</a>
								</li>
								
								<li >
									<a href="#"><i class="fa fa-flag"></i> 店铺消费记录</a>
								</li>
							</ul>
						</li>

						<li class=" treeview ">
							<a href="#">
								<i class="fa fa-bell-o"></i> <span>订单管理</span>
								<span class="pull-right-container">
                            <i class="fa fa-angle-left pull-right"></i>
                          </span>
							</a>
							<ul class="treeview-menu">
								<li >
									<a href="/orderManage/"><i class="fa fa-bell"></i> 订单详情</a>
								</li>
							</ul>
						</li>

						<li class=" treeview ">
							<a href="#">
								<i class="fa fa-envelope-o"></i> <span>广告管理</span>
								<span class="pull-right-container">
                            <i class="fa fa-angle-left pull-right"></i>
                          </span>
							</a>
							<ul class="treeview-menu">
								<li >
									<a href="/adPage/"><i class="fa fa-envelope"></i> 广告详情</a>
								</li>
							</ul>
						</li>

					</ul>
				</section>
			</aside>

			<!-- Content Wrapper. Contains page content -->
			<div class="content-wrapper">
				<!-- Content Header (Page header) -->
				<section class="content-header">
					<h1>
        
        {% block contentLeft %}{% endblock %}
        
      </h1> {% block contentRight %}{% endblock %}

				</section>

				<!-- Main content -->
				<style>
					.content {
						padding: 0 5%;
					}
				</style>
				<section class="content">
					<!--内容区域-->
					{% block content %}{% endblock %}
				</section>
				<!-- /.content -->
			</div>
			<!-- /.content-wrapper -->

			<footer class="main-footer">
				<div class="pull-right hidden-xs">
					<b>Version</b> 2.4.0
				</div>
				<strong>Copyright &copy; 2014-2016 <a href="https://adminlte.io">Almsaeed Studio</a>.</strong> All rights reserved.
			</footer>

			<!-- Control Sidebar -->
			<aside class="control-sidebar control-sidebar-dark">
				<!-- Create the tabs -->
				<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
					<li>
							<div class="tab-pane" id="control-sidebar-settings-tab" style="margin-left:25px">
									<form method="post">
										<h3 class="control-sidebar-heading"><a href="/redpack/" style="color:white">红包记录</a></h3>
										
										
										<div class="form-group">
										</div>
									
			
										<div class="form-group">
											
										</div>
			
										<h3 class="control-sidebar-heading" href="###"><a href="##" style="color:white">返利设置</a></h3>
			
										<div class="form-group">
											
										</div>
			
										<div class="form-group">
											<!-- <label class="control-sidebar-subheading">
						  Turn off notifications
						  <input type="checkbox" class="pull-right">
						</label> -->
										</div>
										<div class="form-group">
											<!-- <label class="control-sidebar-subheading">
						  Delete chat history
						  <a href="javascript:void(0)" class="text-red pull-right"><i class="fa fa-trash-o"></i></a>
						</label> -->
					
										</div>
										<h3 class="control-sidebar-heading" href="###"><a href="/luckyManage/" style="color:white">福袋设置</a></h3>
										<h3 class="control-sidebar-heading" href="###"><a href="/secondkillManage/" style="color:white">秒杀活动</a></h3>
									</form>
								</div>
					</li>
					<!-- <li>
						<a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a>
					</li> -->
				</ul>
				<!-- Tab panes -->
				<div class="tab-content">
					<!-- Home tab content
					<div class="tab-pane" id="control-sidebar-home-tab"> -->
				</div>
			</aside>

			<div class="control-sidebar-bg"></div>

		</div>
		
		
			<!--弹出层时背景层DIV-->
		<div id="fadeMe" class="black_Overlay">
		</div>
		<div id="MyDivMe" class="white_Content" style="height: 800px;">
			<div style="text-align: right; cursor: default; height: 40px;" id="move">
				<span style="font-size: 16px;" onclick="CloseDiv('MyDivMe','fadeMe')">关闭</span>
			</div>
			<!--目前来说，我还是喜欢这个自己改造的弹出层。自己在项目中也用的是这个。-->
			<div id="">
				<div>
					<h1>留言内容：</h1>
				</div>
				<div id="btns">
					<div id="leavingMessageOne" style="height: 250px;border: 2px solid bisque;width: 100%;font-size: 20px;overflow: auto;">
					</div>
					<br />
					<div style="height: 200px; border: 1px solid seagreen;width: 100%;overflow: auto;font-size: 20px;" contentEditable="true" placeholder="输入回复内容">
					</div>
					<br />
					<div style="text-align: center;">
						<button class="btn btn-default delete" style="position: absolute;bottom: 0px;">回复</button>
					</div>
					<br />
				</div>
			</div>
		</div>

	</body>
		<script src="{% static 'js/jquery.js' %}"></script>
		<script src="{% static 'js/bootstrap.min.js' %}"></script>

		<script src="{% static 'js/fastclick.js' %}"></script>

		<script src="{% static 'dist/js/adminlte.min.js' %}"></script>

		<script src="{% static 'utf8-php/ueditor.config.js' %}"></script>

		<script src="{% static 'utf8-php/ueditor.all.min.js' %}"></script>

		<script src="{% static 'utf8-php/lang/zh-cn/zh-cn.js' %}"></script>

		<script src="{% static 'js/jquery.form.min.js' %}"></script>

		<script src="{% static 'js/jquery.twbsPagination.min.js' %}"></script>

		<script src="{% static 'js/tool.js' %}"></script>
		
		<script src="{% static 'layer/layer.js' %}" type="text/javascript" charset="utf-8"></script>
		
		<script src="{% static 'js/recorder.js' %}"></script>
		
		<script src="{% static 'DatePicker/WdatePicker.js' %}"></script>
				
		
		<script type="text/javascript">
			// 获取session
			myGet("getSession" , function (data) {
				session=data.data.toString()
				console.log("获取缓存成功.....");
				// if (session!="true"){
				// 	localStorage.clear();
				// 	window.location.href= HomeUrl
				// 	var data = JSON.parse(localStorage.getItem("data"));
				// }
			} , function (error) {
				layer.msg("请求session失败")
			});

			$(".exit").click(function(){
				//清除缓存
				localStorage.clear(); 
    
				//清除session
				$.ajax({
					url: "http://localhost:8000/setSession/",
					success: function (data) {
						
						window.location.href = "http://localhost:8000";
					},
				});
				
			})
			
			$('.treeview-menu').find('a').each(function() {
				if(this.href == document.location.href || document.location.href.search(this.href) >= 0) {
					$(this).parent().addClass('active'); // this.className = 'active';
					$(this).parents(".treeview").addClass('active');
				}
			});
			
			var leavingMessageData = ""
			var unreadMess = 0;
			var url = HomeUrl + "guestbookSelect/";
			$.ajax({
				url: url,
				type: 'POST',
				success: "success",
				success: function(result) {
					leavingMessageData = result["data"]
					if (window.location.href.indexOf("/leavingMessage/") != -1) {
						callLeavingFn(leavingMessageData);
					}
					for(var sss = 0;sss<result["data"].length;sss++){
						if (result["data"][sss]["status"] == "unread"){
							var userName = result["data"][sss]["username"]
							var userLeaveMessage = result["data"][sss]["leavemessage"]
							var userHeading = result["data"][sss]["userHeading"]
							var userLeavTime = result["data"][sss]["leavtime"]
							unreadMess = unreadMess+1;
							var spanAddss = '<li class = "mytr leavingMess"><a><div class="pull-left"><img src=' + HomeUrl + 'static/myfile/' + userHeading + ' class="img-circle" alt="User Image"></div><h4>'+userName+'<small><i class="fa fa-clock-o"></i> '+userLeavTime+'</small></h4><p>'+userLeaveMessage+'</p></a></li>'
							
							$("#messageRead").append(spanAddss)
						}
					}
					dianJi();
					var spanAdd = "<span class='label label-success'>"+unreadMess+"</span>";
					$("#messageNumber").append(spanAdd) 
					var liAdd = "<li class='header'>You have "+unreadMess+" messages</li>";
					$("#allMessage").append(liAdd) 
				},
				error: function(msg) {
					console.log(msg); //错误信息
				}
			});
			
			
			var data = JSON.parse(localStorage.getItem("logMsg"));
			aaa=data.names;
			document.getElementById('xxxxxxxx').innerHTML = aaa;
			document.getElementById('yyy').innerHTML = aaa;			
		
			
			function dianJi(){
				$(".leavingMess").click(function () {
				var btnIndex = $(this).index();
				ShowDivMe('MyDivMe','fadeMe' , leavingMessageData[btnIndex])
				});
			}
			
		
			//	弹出隐藏层
			function ShowDivMe(show_Div, bg_Div , userLeaveMessage) {
				document.getElementById(show_Div).style.display = 'block';
				document.getElementById(bg_Div).style.display = 'block';
				var bgdiv = document.getElementById(bg_Div);
				bgdiv.style.width = document.body.scrollWidth;
				// bgdiv.style.height = $(document).height();
				$("#" + bg_Div).height($(document).height());
				
				userLeaveMessage = userLeaveMessage["leavemessage"]
				
				var myHtml = '<div>'+ userLeaveMessage +'</div>'
				$("#leavingMessageOne").children('div').remove();
				$("#leavingMessageOne").append(myHtml)
			};
			//关闭弹出层
			function CloseDiv(show_Div, bg_Div) {
				document.getElementById(show_Div).style.display = 'none';
				document.getElementById(bg_Div).style.display = 'none';
			};

			$(".breadcrumb").find('a').click(function(){
				window.location.href = "/goodsManage/";
			})
		</script>



		
		{% block script %}{% endblock %}
	

</html>